package handlers

import (
	"film-manage-sys/models"
	"github.com/gin-gonic/gin"
)

func Add(c *gin.Context) {
	title := c.PostForm("title")
	comment := c.PostForm("comment")

	data := models.Article{
		Title:   title,
		Comment: comment,
	}
	models.DB.Create(&data)
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "添加成功",
	})
	return
}
func List(c *gin.Context) {
	var article []models.Article
	models.DB.Find(&article)
	c.JSON(200, gin.H{
		"code": 200,
		"data": article,
		"msg":  "ok",
	})
	return
}
